<%@page import="com.ignou.mca.beans.UserVO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>OES - Change Password</title>
<script language="javascript">
	function userfocus() 
	{
		document.fm.oldPassword.focus();
	}

	function check() 
	{
		var oldPwd, newPwd, confPwd;
		oldPwd = document.fm.oldPassword.value;
		newPwd = document.fm.newPassword.value;
		confPwd = document.fm.confirmNewPassword.value;
		
		if (oldPwd.length < 1) 
		{
			alert("You must enter old password.");
			document.fm.oldPassword.focus();
			return false;
		} else if (newPwd.length < 1) 
		{
			alert("You must enter new password");
			document.fm.newPassword.focus();
			return false;
		}
		else if (confPwd.length < 1) 
		{
			alert("You must confirm new password");
			document.fm.confirmNewPassword.focus();
			return false;
		}else if(newPwd != confPwd)
		{
			alert("New password and confirm password should be same");
			document.fm.newPassword.value = "";
			document.fm.confirmNewPassword.value = "";
			document.fm.newPassword.focus();
			return false;
		}
		return true;
	}
</script>
</head>
<body onload="userfocus()">
	<div id="MainWrapper">
		<jsp:include page="header.jsp" /> 
		<jsp:include page="LeftContainer.jsp" />
		<div id="MainContent">
			<center><h2>Change Password</h2></center>
			<%
			UserVO uvo = (UserVO) session.getAttribute("UserVO");
			if(uvo==null)
			{
				response.sendRedirect("./Login.jsp");
			}
			else
			{
			
			%>
			<form action="ChangePassword" method="post" name="fm" onsubmit="return check()">
				<table>
					<tr><td>Old Password: </td><td><input type="password" name="oldPassword"/></td></tr>
					<tr><td>New Password: </td><td><input type="password" name="newPassword"/></td></tr>
					<tr><td>Confirm New Password: </td><td><input type="password" name="confirmNewPassword"/></td></tr>
					<tr><td></td><td><input type="submit" name="submit" value="Submit"/></td></tr>
				</table>
				<input type="hidden" name="userName" value="<%=uvo.getUserName()%>"/>
			</form>
			<%
			}
			%>
		</div>
		<jsp:include page="footer.jsp" />
	</div>
</body>
</html>